<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link href=../static/bootstrap-3.3.7-dist/css/bootstrap.min.css rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    <style>
body {
  padding-top: 40px;
  padding-bottom: 40px;
  background-color: #eee;
}

.form-signin {
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
  margin-bottom: 10px;
}
.form-signin .checkbox {
  font-weight: normal;
}
.form-signin .form-control {
  position: relative;
  height: auto;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
</style>
</head>
 <div class="container">
      <div class="form-signin">
        <h2 class="form-signin-heading">请注册</h2>
        <label for="inputUsername" class="sr-only">用户名</label>
        <input type="text" id="regname" name="inputUsername" class="form-control" placeholder="用户名" required autofocus>
        <label for="inputPassword" class="sr-only">密码</label>
        <input type="password" id="regpass" class="form-control" placeholder="密码" required>
        <button id="register-btn" class="btn btn-lg btn-primary btn-block" type="submit">注册</button>
      </div>
    </div> <!-- /container -->

</body>
<script>
   $("#register-btn").click(function () {
       $.ajax({
           url:'/registerapi',
           type:'post',
           dataType:'json',
           data:{
               uname:$("#regname").val(),
               passwd:$("#regpass").val(),
           },
           success:function (res) {
               alert(res.data);
               window.location.href='/entry';
           }
       });
    });
</script>
</html>
